<?php

namespace common\models\user;

use Yii;

/**
 * This is the model class for table "{{%user}}".
 *
 * @property int $id
 * @property string $username
 * @property string $mobile
 * @property string $email
 * @property string $avatar 头像
 * @property string $auth_key
 * @property string $password_hash
 * @property string $password_reset_token
 * @property string $ip
 * @property int $status
 * @property string $created_at
 * @property string $updated_at
 * @property string $deleted_at
 */
class User extends \common\base\ActiveRecord {

    /**
     * @inheritdoc
     */
    public static function tableName() {
        return '{{%user}}';
    }

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['username', 'mobile', 'email', 'auth_key', 'password_hash'], 'required'],
            [['gender', 'ip', 'created_at', 'updated_at', 'deleted_at'], 'integer'],
            [['username'], 'string', 'max' => 100],
            [['mobile', 'auth_key'], 'string', 'max' => 32],
            [['status'], 'string', 'max' => 1],
            [['email', 'avatar', 'cover', 'password_hash', 'password_reset_token'], 'string', 'max' => 255],
            [['username'], 'unique'],
            [['mobile'], 'unique'],
            [['email'], 'unique'],
            [['password_reset_token'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'username' => 'Username',
            'mobile' => 'Mobile',
            'email' => 'Email',
            'avatar' => '头像',
            'cover' => '头像',
            'auth_key' => 'Auth Key',
            'password_hash' => 'Password Hash',
            'password_reset_token' => 'Password Reset Token',
            'ip' => 'Ip',
            'status' => 'Status',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'deleted_at' => 'Deleted At',
        ];
    }

}
